#ifndef PBVP_SPHERE_SHAPE_H
#define PBVP_SPHERE_SHAPE_H

#include "../math/Vector3.h"
#include "../renderer/GLSLProgram.h"
#include "../data/geometrydata.h"
#include "shape.h"

namespace PBVP {
	/// A class for Sphere shapes
	class Sphere : public Shape {
	public:
		/// Destructor
		virtual ~Sphere() {}

		virtual void render();

		double radius;
		Vector3 center;

		/// Construct a sphere
		static Sphere* makeSphere(const Vector3 pnt, double r);

		/// Convert a sphere to a set of triangles
		/**
		 * @param level subdivision level based on an Isosahedron
		 * level = 0, 1 or 2 for 20, 80 and 320 triangles respectively
		 */
		GeometryData* toGeometry(unsigned int level = 0);

	private:
		static GLSLProgram *pGLSLProg;
		static bool initialized;

		static void initGLSLProgram();

		/// Make the constructor private
		Sphere() {}
	};
}
#endif